package com.gitee.demo

object _11ObjectDemo {

  //一个class和object具有同样的名字。这个object称为**伴生对象**，这个class称为**伴生类**
  class CustomerService{
    def save() = println(s"${CustomerService.SERVICE_NAME}:保存用户")
  }

  //CustomerService半生对象
  object CustomerService{
    private val SERVICE_NAME = "CustomerService"
  }

  def main(args: Array[String]): Unit = {
    val customerService = new CustomerService
    customerService.save()
  }

}
